﻿using System.Collections.Generic;
using Model;
using DBUtility;

/*
 * 作者:陈杰
 * QQ  :710782046
 * Email:ovenjackchain@gmail.com
 * Web :http://www.qidian10.com
 */
namespace DAO
{
    public class t403Dao
    {
        /// <summary>
        /// 获得所有记录
        /// </summary>
        /// <returns>返回所有记录IList</returns>
        public IList<t403> FindAll_t403()
        {
            return Common<t403>.Dt2List(DbHelperSQL.FindByConditions(new t403(), ""));
        }
        /// <summary>
        /// 分页获取数据
        /// </summary>
        /// <param name="start">起始记录号</param>
        /// <param name="limit">每页记录数</param>
        /// <param name="conditions">查询条件</param>
        /// <returns>返回符合记录的当前页数据</returns>
        public IList<t403> FindAllByPage_t403(string start, string limit, string conditions)
        {
            return Common<t403>.Dt2List(DbHelperSQL.FindByPage(new t403(), start, limit, conditions));
        }

        /// <summary>
        /// 查找符合条件记录的总条数
        /// </summary>
        /// <param name="conditions">查询条件</param>
        /// <returns>返回符合的记录条数</returns>
        public string GetCount_t403(string conditions)
        {
            return DbHelperSQL.GetCountByConditions(new t403(), conditions);
        }

        /// <summary>
        /// 根据id查找相应的一条记录
        /// </summary>
        /// <param name="id">要查找的ID号</param>
        /// <returns>返回值</returns>
        public t403 FindById_t403(int id)
        {
            t403 model = new t403();
            return Common<t403>.Dt2Model(model, DbHelperSQL.FindByConditions(model, " " + Common<object>.GetModelInfo(model)[1] + "=" + id.ToString()));
        }

        /// <summary>
        /// 添加新纪录
        /// </summary>
        /// <param name="t403">实体</param>
        /// <returns>返回是否成功</returns>
        public bool Add_t403(t403 _t403)
        {
                return DbHelperSQL.Insert(_t403);
        }

        /// <summary>
        /// 更新对象
        /// </summary>
        /// <param name="t403">实体</param>
        /// <returns>返回是否成功</returns>
        public bool Update_t403(t403 _t403)
        {
                return DbHelperSQL.Update(_t403);
        }
        //批量更新
        public bool Update_t403(string sets,string conditions)
        {
                return DbHelperSQL.Update(new t403(),sets,conditions);
        }
        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="t403">实体</param>
        /// <returns>返回是否成功</returns>
        public bool Del_t403(t403 _t403)
        {
                return DbHelperSQL.Delete(_t403);
        }
        //批量删除
        public bool Del_t403(string conditions)
        {
                return DbHelperSQL.Delete(new t403(),conditions);
        }
        /// <summary>
        /// 根据条件查询记录
        /// </summary>
        /// <param name="conditions">条件</param>
        /// <returns>返回符合条件的IList</returns>
        public IList<t403> FindByCondition_t403(string conditions)
        {
            return Common<t403>.Dt2List(DbHelperSQL.FindByConditions(new t403(), conditions));
        }
    }
}
